//
//  homeVC.swift
//  Schedule
//
//  Created by laomi on 2021/6/13.
//

import Foundation
import UIKit


class ScheduleModel: NSObject {
    
}


enum VSScheduleParamKey:String {
   case idParam = "id"
   case nameParam = "name"
   case timeZone = "timeZone";
   case swiftKey = "kCTMediatorParamsKeySwiftTargetModuleName"
   case callbackKey = "callbackKey"
}

class Home:NSObject{
    static func test()->Void{
        print("hello world");
    }
}

typealias  MyCallback = (_ param:Any)->Void


class Schedule: UIViewController {
    override func viewDidLoad() {
        let bg:UIView = UIView.init(frame: CGRect.init(x: 0, y: 0, width: 400, height: 400));
        bg.backgroundColor = UIColor.gray;
        self.view.addSubview(bg);
        self.view.backgroundColor = UIColor.white;
        
        
        let btn:UIButton = UIButton.init(frame: CGRect.init(x: 20, y: 20, width: 100, height: 100));
        btn.setTitle("点我点我",for: UIControlState.normal);
        btn.addTarget(self, action: #selector(onClick), for: UIControlEvents.touchUpInside)
        bg.addSubview(btn);
//        btn.addAction(UIAction, for: UIControlEvents.touchUpInside))
//        btn.addAction(() -> Void:{
//            print("参数\(Target_Schedule.param)")
//        }), for: UIControlEvents.touchUpInside);
        
    }
    @objc func onClick(sender:Any) -> Void {
        print("参数\(Target_Schedule.param)")
        self.navigationController?.pushViewController(VSScheduleList.init(), animated: true);
    }
    
    
   @objc public static func test()->UIViewController{
        return self.init();
    }
}
@objc(Target_Schedule)
public class Target_Schedule: NSObject {
    public static var param:NSDictionary=[:];
    var param:NSDictionary = [:]{
        didSet{
            Target_Schedule.param = param
        }
    }
    @objc public static func Action_test(_ param:NSDictionary)->Void{
        print("参数:\(param)");
        print("类方法");
    }
    @objc public func Action_test(_ param:NSDictionary)->Any {
        print("参数:\(param)");
        print("实例方法");
        _ = param[VSScheduleParamKey.idParam.rawValue] as? String;
        (param[VSScheduleParamKey.callbackKey.rawValue] as? MyCallback)?("fsdfs");
        self.param = param;
        return Schedule.test()
    }
}
